<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function totalContent(){
				var content = document.getElementById("content").value;
				
				var arr = content.split('');
				
				var map = new Map();
				
				for(var c of arr){
					if(map.has(c)){
						n = map.get(c);
						map.set(c,n+1)
					}else{
						map.set(c,1);
					}
				}
				var s = "";
				map.forEach(function(value,key,onwMap){
					/* s +=key+"--->"+value+"\n" */
					s += `"${key}"-->
					${value}\n`;
				});
				document.getElementById("total").innerText = s
			}
		</script>
	</head>
	<body>
		<textarea rows="20" cols="40" id="content"></textarea>
		<input type="button" value="统计" onclick="totalContent()" />
		<div id="total">
			
		</div>
	</body>
</html>
